New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dnsdist: add EDNSOptionRule #6803
Conversation
pdns/dnsdist-ecs.cc
Outdated
bool isEDNSOptionInOpt(const char* optStart, const size_t optLen, const uint16_t optionCodeToFind) | ||
{ | ||
/* we need at least: | ||
root label (1), type (2), class (2), ttl (4) + rdlen (2)*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've seen this comment so often already, maybe it's time to stick the lengths into a #define or think about some other code sharing...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, at least dnsdist-ecs.cc might need some refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but let's do that after this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, a "negative" test would be nice.
addAction(EDNSOptionRule(8), DropAction()) | ||
""" | ||
|
||
def testDropped(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add a test proving that a query without the corresponding option is not dropped :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed
|
||
_config_template = """ | ||
newServer{address="127.0.0.1:%s"} | ||
addAction(EDNSOptionRule(8), DropAction()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to export EDNSOptionCode.Cookie
, EDNSOptionCode.ECS
and so on to Lua
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed
pdns/dnsdist-ecs.cc
Outdated
bool isEDNSOptionInOpt(const char* optStart, const size_t optLen, const uint16_t optionCodeToFind) | ||
{ | ||
/* we need at least: | ||
root label (1), type (2), class (2), ttl (4) + rdlen (2)*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, at least dnsdist-ecs.cc might need some refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This PR now has a conflict following my merge of #6831, sorry about that :-/ |
Squashed! |
pdns/dnsdist-lua-vars.cc
Outdated
@@ -69,6 +69,20 @@ void setupLuaVars() | |||
{"Additional",3 } | |||
}); | |||
|
|||
g_lua.writeVariable("EDNSOptionCode", std::unordered_map<string,int>{ | |||
{"NSID", 3 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nit, but perhaps this would be better:
{ "NSID", EDNSOptionCode::NSID },
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Short description
This adds
EDNSOptionRule
, used as follows (8 is edns-client-subnet):Needs:
Checklist
I have: